from datetime import datetime

from django.contrib.sitemaps import Sitemap

from popboard.models import Thread, Category

class ThreadSitemap(Sitemap):
    changefreq = "daily"
    priority = 0.5
    
    def items(self):
        return Thread.live_objects.all()

    def lastmod(self, obj):
        return obj.modified
        
class CategorySitemap(Sitemap):
    changefreq = "weekly"
    priority = 0.5

    def items(self):
        return Category.objects.all()

    def lastmod(self, obj):
        return datetime.now()